import { _decorator, Component, director, Node, Scene } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('startUI')
export class startUI extends Component {
    @property(Node)
    public startBt: Node = null!;
    @property(Node)
    public exitBt: Node = null!;

    onLoad() {
        // 初始化按钮
        this.init();
    }

    init() {
        // 开启监听
        this.startBt.on(Node.EventType.TOUCH_END, (event: Event) => {
            // 淡出效果
            // const currentScene = director.getScene()!;
            // const node = currentScene.getChildByName('Canvas');
            // node.emit('fade-out');
            // 移动场景到main
            director.loadScene("main");
        }, this.startBt);

        this.exitBt.on(Node.EventType.TOUCH_END, (event: Event) => {
            // 结束游戏
            director.end();
        }, this.exitBt);
    }

    start() {

    }

    update(deltaTime: number) {
        
    }

}


